<template>
  <div class='base'>
    <div class='cube'></div>
    <div class='cube'></div>
    <div class='cube'></div>
    <div class='cube'></div>
    <div class='cube'></div>
    <div class='cube'></div>
    <div class='cube'></div>
    <div class='cube'></div>
    <div class='cube'></div>
  </div>
</template>
<script>
import '../../views/BlogFront/utils/prefixfree.min'
export default {
  name: "cube3D",
  data() {
    return {}
  },
  //计算属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {},
  //生命周期 一 创建完成(可以访问当前this实例)
  created() {

  },
  //生命周期 一 挂载完成(可以访问DOM元素)
  mounted() {

  },
  //生命周期 - 创建之前
  beforeCreate() {
  },
  //生命周期 - 挂载之前
  beforeMount() {
  },
  //生命周期 - 更新之前
  beforeUpdate() {
  },
  //生命周期 - 更新之后
  updated() {
  },
  //生命周期 - 销毁之前
  beforeDestroy() {
  },
  //生命周期 - 销毁完成
  destroyed() {
  },
  //如果页面有keep-alive缓存功能，这个函数会触发
  activated() {
  },
}
</script>

<style lang="less" scoped>
.base {
  height: 15em;
  left: 50%;
  margin: -7.5em;
  padding: 3em;
  position: absolute;
  top: 50%;
  width: 15em;
  transform: rotateX(45deg) rotateZ(45deg);
  transform-style: preserve-3d;
}

.cube,
.cube:after,
.cube:before {
  content: '';
  float: left;
  height: 3em;
  position: absolute;
  width: 3em;
}

/* Top */
.cube {
  background-color: #05afd1;
  position: relative;
  transform: translateZ(3em);
  transform-style: preserve-3d;
  transition: .25s;
  box-shadow: 10em 10em 1.5em rgba(0, 0, 0, 0.1);
  animation: anim 1s infinite;
}
.cube:after {
  background-color: #049dbc;
  transform: rotateX(-90deg) translateY(3em);
  transform-origin: 100% 100%;
}
.cube:before {
  background-color: #048ca7;
  transform: rotateY(90deg) translateX(3em);
  transform-origin: 100% 0;
}
.cube:nth-child(1) {animation-delay: 0.05s;}
.cube:nth-child(2) {animation-delay: 0.1s;}
.cube:nth-child(3) {animation-delay: 0.15s;}
.cube:nth-child(4) {animation-delay: 0.2s;}
.cube:nth-child(5) {animation-delay: 0.25s;}
.cube:nth-child(6) {
  animation-delay: 0.3s;}
.cube:nth-child(7) {animation-delay: 0.35s;
}
.cube:nth-child(8) {animation-delay: 0.4s;}
.cube:nth-child(9) {animation-delay: 0.45s;}

@keyframes anim {
  50% {
    transform: translateZ(0.5em);
  }
}
</style>